<template>
	<view>
		<u-cell-group>
			<u-cell-item :arrow="false" v-for="(item,index) in taskinfo.taskDO.classDOList"  :key="index">
				<view  style="line-height: 50rpx;"  slot="label">
					<p>课程名称：{{item.courseDO.name}}</p>
					<p>学院：{{item.courseDO.collegeName}}</p>
					<p>授课教师：{{item.userDO.name}}</p>
					<p>电话：{{item.userDO.telephone}}</p>
					<p>邮箱：{{item.userDO.email}}</p>
					<p v-if="item.userEvaluateDO">总体评分：{{item.userEvaluateDO.overallScore}}</p>
					<p v-if="item.userEvaluateDO">实际得分：{{item.userEvaluateDO.actualScore}}</p>
				</view>
				<view slot="right-icon">
					<p v-if="item.userDO.avatarUrl"><u-avatar  style="position: relative;left: 46rpx;" :src="item.userDO.avatarUrl"></u-avatar></p> 
					<p v-else ><u-avatar  style="position: relative;left: 40rpx;background-color: #dfdfdf;" :text="item.userDO.name"></u-avatar></p>
					<p v-if="item.userEvaluateDO"><u-button @click="gotoEvaluateDetails(item.classId)" style="margin: 20rpx;height: 60rpx;" type="warning">详情</u-button></p>
					<view v-else>
						<p><u-button  @click="detailsOfStartTime(item.classId)" style="margin: 20rpx;height: 60rpx;" type="primary" size="default">课表</u-button></p>
						<p><u-button style="margin: 20rpx;height: 60rpx;" @click="startClass(item.classId)" type="success" size="default">评价</u-button></p>
					</view>
				</view>
			</u-cell-item>
		</u-cell-group>
		<drag-button
			:isDock="true"
		></drag-button>
	</view>
</template>

<script>
	import dragButton from '../../components/drag-button/drag-button.vue'
	export default{
		components:{dragButton},
		data(){
			return{
				taskTeacherId:null
			}
		},
		methods:{
			detailsOfStartTime(classId){
				this.$u.route({
					"url":"pages/task/detailsOfStartTime",
					"params":{
						"taskTeacherId":this.taskTeacherId,
						"classId":classId
					}
				})
			},
			startClass(classId){
				this.$u.route({
					"url":"pages/task/startClass",
					"params":{
						"taskTeacherId":this.taskTeacherId,
						"classId":classId
					}
				})
			},
			gotoEvaluateDetails(classId){
				this.$u.route({
					"url":"pages/task/evaluationDetails",
					"params":{
						"taskTeacherId":this.taskTeacherId,
						"classId":classId
					}
				})
			}
		},
		onLoad(val) { 
			this.taskTeacherId = val.taskTeacherId
		},
		computed:{
			taskinfo(){
				return this.$store.state.myTaskList?.find(f=>f.taskTeacherId == this.taskTeacherId)
			}
		}
	}
</script>

<style>
</style>
